package com.mark.anto.service.impl;

import com.mark.anto.service.CalculateService;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

/**
 * @Description: Java 7 foreach 实现 {@link CalculateService}
 * @Author: Mark
 * @CreateDate: 2019/9/1 9:06
 * @Version: 3.00.001
 * @Copyright : 豆浆油条个人非正式工作室
 */
@Profile(CalculateService.JAVA7_PROFILE_VALUE)
@Service
public class CalculateServiceImplByJava7 implements CalculateService {

    @Override
    public Integer sum(Integer... values) {
        System.out.println("Java 7 for 循环实现 ");
        int sum = 0;
        for (Integer value : values) {
            sum += value;
        }
        return sum;
    }
}
